home *** CD-ROM | disk | FTP | other *** search
- unit builder1;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- DB, DBTables, StdCtrls, ExtCtrls, DBCtrls, Grids, DBGrids;
-
- type
- TForm1 = class(TForm)
- Table1: TTable;
- DataSource1: TDataSource;
- DBGrid1: TDBGrid;
- DBNavigator1: TDBNavigator;
- Button1: TButton;
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.Button1Click(Sender: TObject);
- type
- TTestRec = record
- DelFlag: Byte;
- EmpNo: SmallInt;
- FirstName: string[15];
- LastName: string[20];
- HireDate: TDateTime;
- DeptNo: string[3];
- Salary: Double;
- end;
- var
- OutFile: file of TTestRec;
- OutRec: TTestRec;
- begin
- AssignFile(OutFile, 'Test1.Dat');
- Rewrite(OutFile);
- try
- with Table1 do begin
- Open;
- try
- while not Eof do begin
- with OutRec do begin
- DelFlag := 0;
- EmpNo := FieldByName('Emp_No').AsInteger;
- FirstName := FieldByName('First_Name').AsString;
- LastName := FieldByName('Last_Name').AsString;
- HireDate := FieldByName('Hire_Date').AsDateTime;
- DeptNo := FieldByName('Dept_No').AsString;
- Salary := FieldByName('Salary').AsFloat;
- end;
-
- Write(OutFile, OutRec);
-
- Next;
- end;
- finally
- Close;
- end;
- end;
- finally
- CloseFile(OutFile);
- end;
- end;
-
- end.
-